<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>测试</title>
  </head>
  <body>
   
    <div id="app">
        测试
    </div>
    <!-- built files will be auto injected -->
  </body>
</html>
<script>
    // 调用授权方法（安卓端暴露接口 doPlatformAppAuth）

    function getQueryVariable() {
        let query = (window.location.search &&window.location.search.substring(1)) || window.location.hash.split("?")[1];;
        let key_values = query.split("&");
        let params = {};
        key_values.forEach(function(key_val){
            let key_val_arr = key_val.split("=");
            params[key_val_arr[0]] = key_val_arr[1];
        });
        return params;
   } 

   function getAuth(params){
                if(window.WebPage && window.WebPage.requestToCX){
                  //调用本地native方法
                    window.WebPage.requestToCX(JSON.stringify(params))
                }
                else{
                    alert('android.getOAuthCode is undefined')
             }
     }  
    window.responseFromCX=function(res){
          alert("收到返回值："+typeof res==='string'?res:JSON.stringify(res))
          const data=typeof res==='string'?JSON.parse(res):res;
          //const {cx_platform_auth_error_code,cx_platform_auth_result}=data;
          const {cx_platform_error_code,cx_platform_result}=data;
          if(cx_platform_error_code==0){
              alert(cx_platform_result);
          }
          else{
              alert(cx_platform_result)
          }
       }

    var params=getQueryVariable();
    if(!params['cx_platform_enterprise_id']){
         alert("没有传入组织id")
    }
    else{
      alert("组织id"+params['cx_platform_enterprise_id'])

    }
    // 此处固定值，便于橙讯
    var json= {
      "cx_platform_action" : "cx_platform_action_auth",
      "cx_platform_app_key" : "APPD67F241CA68F8F82C700D4FC",
      "cx_platform_enterprise_id" : "652267137875968"
     }

     getAuth(json)
  
  
</script>